// 医护管理-体温记录

import r from '@/utils/request';
import type { ResponseType, ListParams, ListResponseType } from '../types';

enum API {
    temperatureList = '/temperature/list', // 体温记录列表
    temperatureGet = '/temperature/get', // 获取单条体温记录信息
    temperatureDelete = '/temperature/delete', // 删除体温记录信息
    temperatureAdd = '/temperature/add', // 体温记录添加
    temperatureUpdate = '/temperature/update', // 体温记录修改  
    temperatureDeleteAll = '/temperature/deleteAll', // 批量删除体温记录
}

export interface temperatureItem {
    id: number;
}

// 体温记录列表参数
interface temperatureListParams extends ListParams {
    name: string;
    beginDate: string;
    endDate: string;
    begId: string;
    addTime: string;
    staffId: number;
}

// 体温记录列表返回值
type temperatureListRes = ListResponseType<{
    id:              number;
    companyId:       number;
    elderlyId:       number;
    addTime:         string;
    addAccountId:    number;
    val:             string;
    begId:           number;
    begName:         string;
    idCard:          string;
    addAccountName:  string;
    addAccountPhoto: string;
    elderlyName:     string;
    elderlyPhoto:    string;
    elderlyGender:   string;
    elderlyIdCard:   string;
    houseName:       string;
    buildingName:    string;
    staffId:         number;
    staffName:       string;
    staffPhoto:      string;
}>

// 体温记录列表接口
export function temperatureListAPI(params: temperatureListParams): Promise<temperatureListRes> {
    return r.get(API.temperatureList, params)
}

// 获取单条体温记录信息返回值
type temperatureGetRes = ResponseType<{
    id:              number;
    companyId:       number;
    elderlyId:       number;
    addTime:         string;
    addAccountId:    number;
    val:             string;
    begId:           number;
    begName:         string;
    idCard:          string;
    addAccountName:  string;
    addAccountPhoto: string;
    elderlyName:     string;
    elderlyPhoto:    string;
    elderlyGender:   string;
    elderlyIdCard:   string;
    houseName:       string;
    buildingName:    string;
    staffId:         number;
    staffName:       string;
    staffPhoto:      string;
}>

// 获取单条体温记录信息接口
export function temperatureGetAPI(id: number): Promise<temperatureGetRes> {
    return r.get(API.temperatureGet + '/' + id)
}

// 删除体温记录信息接口
export function temperatureDeleteAPI(id: number): Promise<ResponseType<string>> {
    return r.delete(API.temperatureDelete + '/' + id)
}

// 体温记录添加参数
interface temperatureAddParams {
    elderlyId: number;
    staffId:   number;
    val:       string;
}

// 体温记录添加返回值
type temperatureAddRes = ResponseType<{
    id:              number;
    companyId:       number;
    elderlyId:       number;
    addTime:         string;
    addAccountId:    number;
    val:             string;
    begId:           number;
    begName:         string;
    idCard:          string;
    addAccountName:  string;
    addAccountPhoto: string;
    elderlyName:     string;
    elderlyPhoto:    string;
    elderlyGender:   string;
    elderlyIdCard:   string;
    houseName:       string;
    buildingName:    string;
    staffId:         number;
    staffName:       string;
    staffPhoto:      string;
}>


// 体温记录添加接口
export function temperatureAddAPI(params: temperatureAddParams): Promise<temperatureAddRes> {
    return r.post(API.temperatureAdd, params)
}


// 体温记录修改参数
interface temperatureUpdateParams {
    elderlyId: number;
    val:       string;
}

// 体温记录修改返回值
type temperatureUpdateRes = ResponseType<{
    id:              number;
    companyId:       number;
    elderlyId:       number;
    addTime:         string;
    addAccountId:    number;
    val:             string;
    begId:           number;
    begName:         string;
    idCard:          string;
    addAccountName:  string;
    addAccountPhoto: string;
    elderlyName:     string;
    elderlyPhoto:    string;
    elderlyGender:   string;
    elderlyIdCard:   string;
    houseName:       string;
    buildingName:    string;
    staffId:         number;
    staffName:       string;
    staffPhoto:      string;
}>

// 体温记录修改接口
export function temperatureUpdateAPI(params: temperatureUpdateParams): Promise<temperatureUpdateRes> {
    return r.put(API.temperatureUpdate, params)
}

// 批量删除体温记录接口
export function temperatureDeleteAllAPI(id: number[]): Promise<ResponseType<string>> {
    return r.post(API.temperatureDeleteAll, id)
}